<template>
  <div class="nav" :style="{ top, position }">
    <div class="b1"></div>
    <div class="b2">猫眼电影</div>
    <div class="b3" @click.stop="showNav">
      <img src="../assets/img/nav-btn.png" alt="" />
    </div>
    <div class="bar" v-show="showNavVisble">
      <a href="">首页</a>
      <a href="">榜单</a>
      <a href="">热点</a>
      <a href="">商城</a>
    </div>
  </div>
</template>

<script>
export default {
  name: "MyHeader1",
  props: ["top", "position"],
  data() {
    return {
      showNavVisble: false,
    };
  },
  mounted(s) {
    document.body.addEventListener("click", () => {
      this.showNavVisble = false;
    });
  },
  methods: {
    showNav() {
      this.showNavVisble = !this.showNavVisble;
    },
  },
};
</script>

<style scoped>
.nav {
  top: 50px;
  width: 10rem;
  background-color: #e54847;
  display: flex;
  justify-content: space-between;
  text-align: center;
  height: 50px;
  line-height: 50px;
  color: #fff;
  align-items: center;
  z-index: 999;
}
.bar {
  position: fixed;
  width: 2.9333rem;
  height: 185px;
  top: 0.96rem;
  right: 0.24rem;
  z-index: 999;
  background: #fff;
  box-shadow: 0 0.06rem 0.18rem 0 rgb(0 0 0 / 10%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.bar a {
  width: 110px;
  height: 45.25px;
  color: #333;
  text-align: center;
  line-height: 45px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}
.b1 {
  width: 2.6667rem;
  height: 39px;
}

.b2 {
  width: 4.3467rem;
  height: 38px;
  font-size: 18px;
  line-height: 38px;
}

.b3 {
  width: 2.6667rem;
  height: 38px;
  line-height: 38px;
}

.b3 img {
  width: 17px;
  height: 16px;
  margin-right: -60px;
}
</style>